import request from "@/utils/request";

// 获取预备项目列表
export function getReadyProjectListApi(query, data) {
  return request({
    url: "/system/proTask/selectTransitionManagerList",
    method: "post",
    params: query,
    data,
  });
}


// 获取项目列表
export function getProjectSelfListApi(query, data) {
  return request({
    url: "/system/proTask/selectProjectPassList",
    method: "post",
    params: query,
    data,
  });
}



// 获取项目任务列表
export function getProjectTaskListApi(query, data) {
  return request({
    url: "/system/center/list",
    method: "post",
    params: query,
    data,
  });
}

// 获取项目归档列表
export function getProjectFileListApi(query, data) {
  return request({
    url: "/system/proTask/selectProjectArchiveList",
    method: "post",
    params: query,
    data,
  });
}

// 启动预备项目
export function startReadyProjectApi(data) {
  return request({
    url: "/system/proStart/insterSatrt",
    method: "post",
    data,
  });
}

// 启动项目详情
export function startProjecDetailApi(projectId) {
  return request({
    url: `/system/proTask/selectProStartByProId`,
    method: "get",
    params: { projectId },
  });
}

// 预备项目详情
export function readyProjecDetailApi(projectId) {
    return request({
      url: `/system/proTask/selectProjectById`,
      method: "get",
      params: { projectId },
    });
  }

// 采购申请物料详情
export function purchaseDetailApi(purchaseApplyId) {
    return request({
      url: `/system/proTask/selectMaterList`,
      method: "get",
      params: { purchaseApplyId },
    });
  }

  // 项目分配任务
export function projectAllotTaskApi(data) {
  return request({
    url: "/system/proTask",
    method: "post",
    data,
  });
}

  // 编辑项目分配任务
  export function projectEditAllotTaskApi(data) {
    return request({
      url: "/system/proTask/implEditPeople",
      method: "post",
      data,
    });
  }

// 获取名下任务
export function getUserTaskApi(userId) {
  return request({
    url: "/system/proTask/findPeopelTasks",
    method: "get",
    params: { userId },
  });
}

// 项目分配任务详情
export function projectTaskDetailApi(projectId) {
  return request({
    url: `/system/proTask/selectTransitionManagerById`,
    method: "get",
    params: { projectId },
  });
}

// 续保列表
export function getRenewalListApi(params) {
  return request({
    url: `/system/proTask/selectGuaranteeList`,
    method: "get",
    params,
  });
}


// 获取项目列表
export function getWorkListApi(query, data) {
  return request({
    url: "/system/proTask/selectListByProjectId",
    method: "post",
    params: query,
    data,
  });
}

// 任务变更记录
export function taskChangeDetailApi(projectTaskId) {
  return request({
    url: `/system/proTask/findRecoreList`,
    method: "get",
    params: { projectTaskId },
  });
}

// 完结项目
export function projectFinishApi(projectId) {
  return request({
    url: `/system/proTask/proEnd`,
    method: "get",
    params: { projectId },
  });
}

// 项目任务-任务详情
export function projectTaskSelfDetailApi(projectId) {
  return request({
    url: `/system/proTask/findProjectMyTaskInfoList`,
    method: "get",
    params: { projectId },
  });
}

// 获取防区列表
export function getDenfenseList() {
  return request({
    url: `/system/proTask/getArmedzoneInfoVo`,
    method: "get",
  });
}

// 获取项目下点位列表
export function getPointList(projectId) {
  return request({
    url: `/system/confluenceChange/findTaskDetailList`,
    method: "get",
    params: { projectId },
  });
}

// 工单退回任务
export function projectReturnTaskApi(data) {
  return request({
    url: "/system/proTask/taskBack",
    method: "post",
    data,
  });
}

// 工单执行、提交任务
export function projectSubmitTaskApi(data) {
  return request({
    url: "/system/center/implEdit",
    method: "post",
    data,
  });
}

// 工单执行、提交任务
export function projectExportTaskApi(data) {
  return request({
    url: "/system/proTask/insertErpProjectExportTask",
    method: "post",
    data,
  });
}

// 项目归档 变更
export function projectFileChangeApi(data) {
  return request({
    url: "/system/confluenceChange/add",
    method: "post",
    data,
  });
}

// 项目归档 详情
export function projectFileDetailApi(projectId) {
  return request({
    url: `/system/proTask/selectProjectArchiveById`,
    method: "get",
    params: { projectId },
  });
}

// 项目归档 新增巡检
export function pollingAddApi(data) {
  return request({
    url: "/system/patrolScheme/add",
    method: "post",
    data,
  });
}

// 项目归档 编辑巡检
export function pollingEditApi(data) {
  return request({
    url: "/system/patrolScheme/edit",
    method: "post",
    data,
  });
}

// 项目归档 变更记录列表
export function changeListApi(data) {
  return request({
    url: "/system/confluenceChange/list",
    method: "post",
    data,
  });
}

// 巡检详情
export function getPollingApi(projectId) {
  return request({
    url: `/system/patrolScheme/findPatrolList`,
    method: "get",
    params: { projectId },
  });
}

// 变更记录详情
export function changeProjecDetailApi(proConfluenceChangeId) {
  return request({
    url: `/system/confluenceChange/findChangeRecordById`,
    method: "get",
    params: { proConfluenceChangeId },
  });
}

// 任务受理
export function taskAcceptApi(data) {
  return request({
    url: "/system/center/updateMissionStatus",
    method: "post",
    data,
  });
}

// 任务退回
export function taskBackApi(data) {
  return request({
    url: "/system/center/returnReasons",
    method: "post",
    data,
  });
}

// 执行任务详情
export function executeTaskInfoApi(missionCenterId) {
  return request({
    url: "/system/center/findProjectMyTaskInfos",
    method: "get",
    params: {missionCenterId}
  });
}

// 工单详情
export function getInfoApi(missionCenterId) {
  return request({
    url: "/system/center/getInfo",
    method: "get",
    params: {missionCenterId}
  });
}
// 工单详情
export function operateLogApi(missionCenterId) {
  return request({
    url: "/system/center/getInfo",
    method: "get",
    params: {missionCenterId}
  });
}

// 项目详情修改
export function projectDetailEditApi(data) {
  return request({
    url: "/system/proStart/updateSatrt",
    method: "post",
    data,
  });
}


// 运维项目最新情况
export function findProjectMyTaskInfosById(businessId) {
  return request({
    url: "/system/center/findProjectMyTaskInfosById",
    method: "get",
    params: {businessId}
  });
}